import { FormConfig } from "@components/FormComponent/types";
import type { FormRules } from "element-plus";
//生成表单的配置项
export const FormCon1: Array<FormConfig> = [
  {
    key: "title",
    label: "帖子标题",
    comType: "el-input",
    placeholder: "输入帖子的标题",
  },
  {
    key: "basiceditor",
    label: "帖子内容",
    comType: "slot",
  },
  {
    key: "uploadfile",
    label: "文件上传",
    comType: "slot",
  },
  {
    key: "sharetype",
    label: "分享类型",
    comType: "slot",
  },
  {
    key: "authority",
    label: "分享对象",
    comType: "el-select",
    placeholder: "选择分享的对象",
    options: [
      {
        label: "全校",
        value: 0
      },
      {
        label: "教师",
        value: 1
      },
      {
        label: "学生",
        value: 2
      }
    ]
  },
  {
    key: "college",
    label: "分享学院",
    comType: "el-select",
    placeholder: "选择可查看的学院",
    options: []
  },
  {
    key: "major",
    label: "分享专业",
    comType: "el-select",
    placeholder: "选择可查看的专业",
    options: []
  },
  {
    key: "grade",
    label: "分享年级",
    comType: "el-select",
    placeholder: "选择可查看的年级",
    options: [
      {
        label: "2019",
        value: "2019"
      },
      {
        label: "2020",
        value: "2020"
      },
      {
        label: "2021",
        value: "2021"
      }
    ]
  },
  {
    key: "options",
    comType: "slot",
  },
];

// 表单验证的规则
export const rules: FormRules = {
  title: [
    { required: true, message: '帖子标题不能为空~', trigger: 'blur' }
  ],
  authoriy: [
    { required: true, message: '分享对象不能为空~', trigger: 'blur' }
  ],
  college: [
    { required: true, message: '学院不能为空~', trigger: 'blur' }
  ],
  major: [
    { required: true, message: '专业不能为空~', trigger: 'blur' }
  ],
  grade: [
    { required: true, message: '年级不能为空~', trigger: 'blur' }
  ]
}
